<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script>
			function show(){
				
				var _aid=aid.value;
				//1.创建异步创建对象
				// console.log(22)
				var xhr=new XMLHttpRequest();
				//2.创建请求，打开连接
				xhr.open("get",`/order/v1/order_search/${_aid}`,true);
				// console.log(33)
			 //3.发送请求
			  xhr.send();
				//4.接收响应，创建监听
				// console.log(44)
				xhr.onreadystatechange=function(){
					// console.log(11)
					if(xhr.readyState==4 && xhr.status==200){
						var r=xhr.responseText;
						// var arr=JSON.parse(r);
						var arr=JSON.parse(r);
								var strHTML=`
								<table border="1" bordercolor="purple" width="800" align="center">
									<tr>
										<th>编号</th>
										<th>使用id</th>
										<th>地址id</th>
										<th>状态</th>
										<th>下单时间</th>
										<th>pay_time</th>
										<th>deliver_time</th>
										<th>received_time</th>
									</tr>
								`;
								for(var i=0;i<arr.length;i++){
								strHTML+=`
								<tr>
									<td>${arr[i].aid}</td>
									<td>${arr[i].user_id}</td>
									<td>${arr[i].address_id}</td>
									<td>${arr[i].stah_id}</td>
									<td>${arr[i].order_time}</td>
									<td>${arr[i].pay_time}</td>
									<td>${arr[i].deliver_time}</td>
									<td>${arr[i].received_time}</td>
								</tr>
								`
								}
								strHTML+="</table>";
								d1.innerHTML=strHTML;
								}
								if(r==0){
									d1.innerHTML="查无此人"
								}
								
							}
						}
		</script>
	</head>
	<body>
		<input type="text" id="aid">编号<br>
	  <button onclick="show()">搜索</button>
		<div id="d1"></div>
	</body>
</html>
